-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[cmake][lldb][test] Respect LIBCXX_LIBDIR_SUBDIR #159106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This code in principle needs to match the one in libc++ but hasn't been updated to account for LIBCXX_LIBDIR_SUBDIR so tests don't work if LLVM is built with it specified. Fixes: ed155f3
|
@llvm/pr-subscribers-lldb Author: Raul Tambre (tambry) ChangesThis code in principle needs to match the one in libc++ but hasn't been updated to account for LIBCXX_LIBDIR_SUBDIR so tests don't work if LLVM is built with it specified. Fixes: ed155f3 Full diff: https://github.com/llvm/llvm-project/pull/159106.diff 2 Files Affected:
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 8116f4c3c823a..513d1ec493ee1 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -164,9 +164,14 @@ if(TARGET clang)
if (TARGET libcxx OR ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES))
set(LLDB_HAS_LIBCXX ON)
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
- set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+ set(LIBCXX_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE})
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBCXX_TARGET_SUBDIR /${LIBCXX_LIBDIR_SUBDIR})
+ endif()
+ cmake_path(NORMAL_PATH LIBCXX_TARGET_SUBDIR)
+ set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXX_TARGET_SUBDIR})
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
- set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
+ set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LIBCXX_TARGET_SUBDIR}/c++/v1")
else()
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
diff --git a/lldb/utils/lldb-dotest/CMakeLists.txt b/lldb/utils/lldb-dotest/CMakeLists.txt
index 3b8c88b6dc78c..f3f75015637f4 100644
--- a/lldb/utils/lldb-dotest/CMakeLists.txt
+++ b/lldb/utils/lldb-dotest/CMakeLists.txt
@@ -15,9 +15,14 @@ llvm_canonicalize_cmake_booleans(
if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
set(LLDB_HAS_LIBCXX ON)
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
- set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+ set(LIBCXX_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE})
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBCXX_TARGET_SUBDIR /${LIBCXX_LIBDIR_SUBDIR})
+ endif()
+ cmake_path(NORMAL_PATH LIBCXX_TARGET_SUBDIR)
+ set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXX_TARGET_SUBDIR})
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
- set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
+ set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LIBCXX_TARGET_SUBDIR}/c++/v1")
else()
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me. Could you update the PR description with an example of what the paths would look like in the case where LIBCXX_TARGET_SUBDIR is specified?
|
@Michael137 Added an example in the description. In-tree it's used by Fucshia for multilib runtimes but I myself use them in my downstream to install the libraries into Debian-style triple system directories instead of LLVM's own quadruple-based structure. Ideally this same logic would be included from libc++ itself but LLVM CMake code in general is quite entangled it's hard to tell how this could even be shared. 😕 |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/21441 Here is the relevant piece of the build log for the reference |
This code in principle needs to match the one in libc++ but hasn't been updated to account for LIBCXX_LIBDIR_SUBDIR so tests don't work if LLVM is built with it specified. Fixes: ed155f3
This code in principle needs to match the one in libc++ but hasn't been updated to account for LIBCXX_LIBDIR_SUBDIR so tests don't work if LLVM is built with it specified.
This functionality is chiefly used by
LLVM_RUNTIME_MULTILIBSsupport so the library path might end up as/usr/lib/llvm-22/lib/x86_64-unknown-linux-gnu/hwasan/libc++.so.1instead of/usr/lib/llvm-22/lib/x86_64-unknown-linux-gnu/libc++.so.1.In my downstream I however (ab)use this same functionality to install the libraries into Debian-style triple directories instead of the quadruples that LLVM nowadays prefers (hence the normalization I added).
Fixes: ed155f3